package service;

import dao.StudentDao;
import entity.Student;
import factory.StudentDaoFactory;

import java.util.List;

public class StudentService {
    private StudentDao studentDao;

    public StudentService() {
        this.studentDao = StudentDaoFactory.getStudentDao();
    }

    //获取学生列表服务
    public List<Student> getStudentListService(int pageindex, int perpage){
        return studentDao.getStudentList(pageindex,perpage);
    }

    //获取学生格式服务
    public long getStudentsCountService(){
        return studentDao.getStudentsCount();
    }

    //添加学生服务
    public void insertStudentService(Student student){studentDao.insertSTudent(student);}

    //删除学生服务
    public void deleteStudentService(int id){studentDao.deleteStudent(id);}

    //修改学生服务
    public void changeStudentService(Student student){
        studentDao.changeStudent(student);
    }

    //根据学号查找学生服务
    public List<Student> findStudentByIdService(String sid){return studentDao.findStudentBySid(sid);}

    //查找某学号学生是否存在
    public boolean ishaveService(String sid){return studentDao.ishave(sid);}
}
